package org.example;

import java.util.Objects;

/**
 * @author 甜圆
 * @version v1.0.1
 * @date 2025/9/23 19:56
 * @package org.example
 * @copyright 甜圆
 */
public class Person2 implements Cloneable {
    private Address address;
    // 省略构造函数、Getter&Setter方法
    @Override
    public Person2 clone() {
        try {
            Person2 person2 = (Person2) super.clone();
            return person2;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError();
        }
    }


    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Person2() {
    }

    public Person2(Address address) {
        this.address = address;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person2 person2 = (Person2) o;
        return Objects.equals(address, person2.address);
    }

    @Override
    public int hashCode() {
        return Objects.hash(address);
    }
}